package cn.schoolwow.util.module.query.instanceList.service;

import cn.schoolwow.quickflow.QuickFlowExecutor;
import cn.schoolwow.quickflow.flow.CompositeBusinessFlow;
import cn.schoolwow.util.module.query.instanceList.flow.filter.*;
import cn.schoolwow.util.module.query.instanceList.handler.FilterInstanceListSingleFlowListener;

public class FilterInstanceListCompositeBusiness implements CompositeBusinessFlow {
    @Override
    public void executeCompositeBusiness(QuickFlowExecutor quickFlowExecutor) {
        quickFlowExecutor.next(new SetFilterInstanceListFlow())
                .next(new CompositeBusinessFlow() {
                    @Override
                    public void executeCompositeBusiness(QuickFlowExecutor quickFlowExecutor) {
                        quickFlowExecutor.singleFlowListener(new FilterInstanceListSingleFlowListener())
                                .next(new FilterInstanceByInstanceValueFlow())
                                .next(new FilterInstanceByFieldValueFlow())
                                .next(new FilterInstanceByFieldListValueFlow())
                                .next(new FilterInstanceByFieldListNotInValueFlow())
                                .next(new FilterInstanceByOrderByFieldNameFlow());
                    }

                    @Override
                    public String name() {
                        return "过滤实例列表";
                    }
                });
    }

    @Override
    public String name() {
        return "根据指定条件过滤实例数组";
    }
}
